home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
GROUPOBJ.PRG
< prev
next >
Wrap
Text File
|
1993-05-04
|
5KB
|
151 lines
PROCEDURE GroupObj
*----------------------------------------------------------------------------
* NAME
* GroupObj - Group objects together.
*
* DESCRIPTION
* Takes the current open SCR DBF file and determines the grouping
* for screen objects based on position and title. The results
* are placed into the CURRENTID, NEXTID, and PREVID fields where
* the value is based on the record number.
*
* A group consists of single objects, where GROUPID and CURRENTID
* have the same value, or a group of objects. The label field
* for the group will hold the record numbers for the first and
* last objects in the group.
*----------------------------------------------------------------------------
SET ORDER TO
SET FILTER TO
STORE 0 TO ln_last, ln_next, ln_current, ln_groupid
SCAN
IF value_type = "B" .OR. value_type = "T"
LOOP
ENDIF
lc_suffix = RIGHT( TRIM( fieldname ), 2 )
DO CASE
*---------------------------------------------------------
*-- Check for control labels for comboboxes, entry fields,
*-- list boxes, radio buttons, and checkboxes
*---------------------------------------------------------
CASE lc_suffix = "_0"
ln_groupid = RECNO()
REPLACE groupid WITH ln_groupid
*------------------------------
*-- Group all the related items
*------------------------------
ln_possuff = AT( "_0", fieldname )
lc_objname = LEFT( fieldname, ln_possuff )
ln_next = 0
ln_last = 0
nMaxLen = 0
SCAN FOR lc_objname = LEFT( fieldname, ln_possuff ) .AND. ;
value_type <> "B" .AND. ;
RIGHT( TRIM( fieldname ), 1 ) <> "0"
ln_current = RECNO()
IF ln_next = 0
ln_next = ln_current
ENDIF
ln_last = ln_current
REPLACE groupid WITH ln_groupid
REPLACE currentid WITH RECNO()
IF LEFT( fieldname, 3 ) $ "RB_,CK_"
nMaxLen = MAX( decimals - col, nMaxLen )
ENDIF
ENDSCAN
*---------------------------------------------------------
*-- Store the group's first and last objects in previd and
*-- nextid fields.
*---------------------------------------------------------
GOTO ln_groupid
REPLACE previd WITH ln_next
REPLACE nextid WITH ln_last
*---------------------------------------------------------------
*-- Make one last scan for the group to adjust length of CB & RB
*---------------------------------------------------------------
IF LEFT( fieldname, 3 ) $ "RB_,CK_"
REPLACE decimals WITH col + nMaxLen ;
FOR lc_objname = LEFT( fieldname, ln_possuff ) .AND. ;
value_type <> "B" .AND. ;
RIGHT( TRIM( fieldname ), 1 ) <> "0"
ENDIF
GOTO ln_groupid
*-----------------------------------------------------------
*-- Check for single item controls, like buttons, checkboxes
*-- and objects without titles.
*-----------------------------------------------------------
CASE LEFT( lc_suffix, 1 ) <> "_" .AND. LEFT( fieldname, 3 ) <> "TI_"
ln_groupid = RECNO()
REPLACE currentid WITH ln_groupid
REPLACE groupid WITH ln_groupid
CASE lc_suffix = "_1" .AND. ISBLANK( groupid )
ln_groupid = RECNO()
REPLACE currentid WITH ln_groupid
REPLACE groupid WITH ln_groupid
ENDCASE
ENDSCAN
*----------------------------------------------------------
*-- Now scan the objects that can get focus and fill in the
*-- NEXTID and PREVID values.
*----------------------------------------------------------
SET ORDER TO ObjOrder
SET FILTER TO .NOT. ISBLANK( currentid )
GO TOP
DO WHILE .NOT. EOF()
nCurr = currentid
*-- Get the previous value
SKIP -1
IF BOF()
GO BOTTOM
nPrev = currentid
GO TOP
ELSE
nPrev = currentid
SKIP
ENDIF
*-- Get the next value
SKIP
IF EOF()
GO TOP
nNext = currentid
GO BOTTOM
ELSE
nNext = currentid
SKIP -1
ENDIF
*-- Store the values
REPLACE nextid WITH nNext, previd WITH nPrev
SKIP
ENDDO
SET FILTER TO
SET ORDER TO
RETURN
*-- EOP: GroupObj